home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
src
/
kernel
/
copy68k.s
< prev
next >
Wrap
Text File
|
1990-07-15
|
14KB
|
344 lines
#include <minix/config.h>
#if (CHIP == M68000)
#ifdef ACK
! (ACK needs an #ifdef before the first comment !)
! Note: ACK converts move.l, sub.l add.l to moveq,subq,addq where possible !
!****************************************************************************
!
! C O P Y _ 6 8 K . S M I N I X
!
! Basic fast copy routines used by the kernel
!****************************************************************************
!
! Contents:
!
! flipclicks exchange two block of clicks
! zeroclicks zero a block of clicks
! copyclicks copy a block of clicks
! phys_copy copy a block of bytes
!
!============================================================================
! Edition history
!
! # Date Comments By
! --- -------- ---------------------------------------------------- ---
! 1 13.06.89 fast phys_copy by Dale Schumacher DAL
! 2 16.06.89 bug fixes and code impromvement by Klamer Schutte KS
! 3 12.07.89 bug fix and further code improvement to phys_copy RAL
! 4 14.07.89 flipclicks,zeroclicks,copyclicks added RAL
! 5 15.07.89 fast copy routine for messages added to phys_copy RAL
! 6 03.08.89 clr.l <ea> changed to move.l #0,<ea> (= moveq ) RAL
!
!****************************************************************************
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
.extern _flipclicks
.extern _zeroclicks
.extern _copyclicks
.extern _phys_copy
!****************************************************************************
!
! f l i p c l i c k s
!
! exchange to blocks of n clicks
!****************************************************************************
!
! Input: on stack:
! fnclick.w - number of clicks to copy
! fadr2cl.w - physical click address 2
! fadr1cl.w - physical click address 1
! (a7) ->(rts_ptr.l) - abs. return ptr.
!
! Output: d0,d1,a0,a1 - *
!
!****************************************************************************
fadr1cl = 0x4 ! click address 1 .w
fadr2cl = 0x6 ! click address 2 .w
fnclick = 0x8 ! number of clicks to flip .w
_flipclicks:
move.l #0,d0
move.w fadr1cl(a7),d0 ! address 1 in clicks
lsl.l #8,d0
move.l d0,a0 ! address 1 ptr.
move.l #0,d0
move.w fadr2cl(a7),d0 ! address 2 in clicks
lsl.l #8,d0
move.l d0,a1 ! address 2 ptr.
move.l #0,d0
move.w fnclick(a7),d0 ! number of clicks to exchange
lsl.l #2,d0 ! need 4 loops to flip a click
movem.l d2-d7/a2-a6,-(a7) ! save registers used for flip
bra endflip
flip64:
movem.l (a0)+,d1-d6 ! load from adr1 6x4 bytes
movem.l (a1)+,d7/a2-a6 ! load from adr2 6x4 bytes
movem.l d7/a2-a6,-24(a0) ! store to adr1 6x4 bytes
movem.l d1-d6,-24(a1) ! store to adr2 6x4 bytes
movem.l (a0)+,d1-d6 ! load from adr1 6x4 bytes
movem.l (a1)+,d7/a2-a6 ! load from adr2 6x4 bytes
movem.l d7/a2-a6,-24(a0) ! store to adr1 6x4 bytes
movem.l d1-d6,-24(a1) ! store to adr2 6x4 bytes
movem.l (a0)+,d1-d4 ! load from adr1 4x4 bytes
movem.l (a1)+,a2-a5 ! load from adr2 4x4 bytes
movem.l a2-a5,-16(a0) ! store to adr1 4x4 bytes
movem.l d1-d4,-16(a1) ! store to adr2 4x4 bytes
endflip:
dbra d0,flip64 ! decrement count, test and loop
sub.l #0x10000,d0 ! dbra handles only word counters
bhi flip64 ! -> next 64 x 64k bytes
movem.l (a7)+,d2-d7/a2-a6 ! restore registers used to flip
rts
!****************************************************************************
!
! z e r o c l i c k s
!
! zero n clicks from source click to destination click address
!****************************************************************************
!
! Input: on stack:
! znclick.w - number of clicks to zero
! zdestcl.w - physical destination click address
! (a7) ->(rts_ptr.l) - abs. return ptr.
!
! Output: d0,d1,a0,a1 - *
!
!****************************************************************************
zdestcl = 0x4 ! destination click address .w
znclick = 0x6 ! number of clicks to zero .w
_zeroclicks:
move.l #0,d0
move.w zdestcl(a7),d0 ! destination address in clicks
lsl.l #8,d0
move.l d0,a0 ! destination ptr.
move.w znclick(a7),d0 ! number of clicks to zero
movem.l d2-d7/a2-a6,-(a7) ! save registers used to zero
move.l #0,d1 ! zero registers
move.l d1,d2
move.l d1,d3
move.l d1,d4
move.l d1,d5
move.l d1,d6
move.l d1,d7
move.l d1,a1
move.l d1,a2
move.l d1,a3
move.l d1,a4
move.l d1,a5
move.l d1,a6
lea 256(a0),a0 ! top of first click
bra endzero
zero256:
movem.l d1-d7/a1-a6,-(a0) ! zero 13x4 bytes
movem.l d1-d7/a1-a6,-(a0) ! zero 13x4 bytes
movem.l d1-d7/a1-a6,-(a0) ! zero 13x4 bytes
movem.l d1-d7/a1-a6,-(a0) ! zero 13x4 bytes
movem.l d1-d7/a1-a5,-(a0) ! zero 12x4 bytes
lea 512(a0),a0 ! top of next click
endzero:
dbra d0,zero256 ! decrement count, test and loop
movem.l (a7)+,d2-d7/a2-a6 ! restore registers used to zero
rts
!****************************************************************************
!
! c o p y c l i c k s
!
! copy n clicks from source click to destination click address
!****************************************************************************
!
! Input: on stack:
! cnclick.w - number of clicks to copy
! cdestcl.w - physical destination click address
! csrccl.w - physical source click address
! (a7) ->(rts_ptr.l) - abs. return ptr.
!
! Output: d0,d1,a0,a1 - *
!
! Rem.: subroutines for this call are common to phys_copy !
!
!****************************************************************************
csrccl = 0x4 ! source click address .w
cdestcl = 0x6 ! destination click address .w
cnclick = 0x8 ! number of clicks to copy .w
_copyclicks:
move.l #0,d0
move.w csrccl(a7),d0 ! source address in clicks
lsl.l #8,d0
move.l d0,a0 ! source ptr.
move.l #0,d0
move.w cdestcl(a7),d0 ! destination address in clicks
lsl.l #8,d0
move.l d0,a1 ! destination ptr.
move.w cnclick(a7),d0 ! number of clicks to copy
movem.l d2-d7/a2-a6,-(a7) ! save registers used for copy
move.l #0,d1 ! no remainder
bra end256
loop256:
movem.l (a0)+,d2-d7/a2-a6 ! copy 11x4 bytes
movem.l d2-d7/a2-a6,(a1)
movem.l (a0)+,d2-d7/a2-a6 ! copy 11x4 bytes
movem.l d2-d7/a2-a6,44(a1)
movem.l (a0)+,d2-d7/a2-a6 ! copy 11x4 bytes
movem.l d2-d7/a2-a6,88(a1)
movem.l (a0)+,d2-